package com.cy.service.impl;



import com.cy.entity.District;
import com.cy.mapper.DistrictMapper;
import com.cy.service.IDistrictService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class IDistrictServiceImpl implements IDistrictService {
    @Autowired
    public DistrictMapper districtMapper;

    @Override
    public List<District> getByParent(String parent) {
        //网络数据传输时将无效数据设置为null 节省流量 提升效率
        List<District> list=districtMapper.findByParent(parent);
        for(District d:list)
        {
            d.setId(null);
            d.setParent(null);
        }
        return list;
    }

    @Override
    public String getNameByCode(String code) {

       return districtMapper.findNameByCode(code);
    }
}
